package com.inspur.edp.common.expr.evaluator;

import lombok.Data;

import java.util.Map;

/**
 * @author lizhaorui
 * @date 2025/11/8
 * @description
 */

@Data
public class NodeParamEvaluator implements ExpressEvaluator {

    private String nodeCode;
    private String paramCode;

    public NodeParamEvaluator(String nodeCode, String paramCode) {
        this.nodeCode = nodeCode;
        this.paramCode = paramCode;
    }

    @Override
    public Object evaluate(Map<String, Object> dataMap) {
        if (dataMap == null) {
            return null;
        }
        Map<String, Object> nodeParamMap = (Map<String, Object>) dataMap.get(this.nodeCode);
        if (nodeParamMap == null) {
            return null;
        }
        return nodeParamMap.get(this.paramCode);
    }

}